<# # It is recommended to test the script on a local machine for its purpose and effects. # Endpoint Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description: Script to check value data of Multiple Regsitry Keys # Remarks: The script has to be deployed as Computer / User Configuration # Configuration Type - Computer / User # Arguments "RegistryPath1" "ValueName1" "RegistryPath2" "ValueName2" # Note: If it is Computer Based Hive the configuration to be executed as Computer Based configuration If it is User Based Hive the configuration to be executed as User Based configuration # Limitation: Mixed path's won't be effective #> # Check if the number of arguments is even (pairs of registry path and value name) if ($args.Length % 2 -ne 0) { Write-Output "Invalid number of arguments. Please provide pairs of registry path and value name." exit } # Process each pair of arguments for ($i = 0; $i -lt $args.Length; $i += 2) { $registryPath = $args[$i] $valueName = $args[$i + 1] if (Test-Path $registryPath) { $value = Get-ItemProperty $registryPath | Select-Object -ExpandProperty $valueName -ErrorAction SilentlyContinue if ($value) { Write-Output "Value of '$valueName' in '$registryPath': '$value'" } else { Write-Output "The registry value '$valueName' in '$registryPath' exists, but it does not have a value." } } else { Write-Output "The registry key '$registryPath' does not exist." } }